# coding: utf-8

import sys
sys.path.append('../3_data_structure')
from deque import Deque


def palindrome(letter):
    deque = Deque()

    for word in letter:
        deque.add_rear(word)

    while deque.size() > 1:
        front = deque.remove_front()
        rear = deque.remove_rear()

        if front != rear:
            return False

    return True


letters = ['madam', 'food', 'tool', 'radar', 'toot']

for letter in letters:
    print(letter, palindrome(letter))
